/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.leiam.eolica.funcoes;

/**
 * 
 * @author Denis
 */
public class ProducaoEnergia {
	private double[] fvpv;
	private double sumfvpv;
	private double[] curvaPotencia, freqRelativa;
	private double EAG = 0;
	private double passo = 1;

	public double calcularEAG() {
		// ---------------------------------------------------------------------------------
		// CALCULO EAG

		//int tamanhoArray = curvaPotencia.length;
		int tamanhoArray = Math.min(freqRelativa.length,curvaPotencia.length);
		setFvpv(new double[tamanhoArray]);

		setEAG(0);
		double[] EAGsum = new double[tamanhoArray];

		for (int i = 0; i < tamanhoArray; i++) {
			try {
				fvpv[i] = (freqRelativa[i] / 100) * curvaPotencia[i] * passo;
			} catch (ArrayIndexOutOfBoundsException e) {
				fvpv[i] = 0;
			}
			
			sumfvpv = sumfvpv + fvpv[i];

			EAGsum[i] = sumfvpv;
		}
		EAG = sumfvpv * 8760 / 1000;
		return EAG;
	}

	/**
	 * @return the fvpv
	 */
	public double[] getFvpv() {
		return fvpv;
	}

	/**
	 * @param fvpv
	 *            the fvpv to set
	 */
	public void setFvpv(double[] fvpv) {
		this.fvpv = fvpv;
	}

	/**
	 * @return the EAG
	 */
	public double getEAG() {
		return EAG;
	}

	/**
	 * @param EAG
	 *            the EAG to set
	 */
	public void setEAG(double EAG) {
		this.EAG = EAG;
	}

	/**
	 * @return the curvaPotencia
	 */
	public double[] getCurvaPotencia() {
		return curvaPotencia;
	}

	/**
	 * @param curvaPotencia
	 *            the curvaPotencia to set
	 */
	public void setCurvaPotencia(double[] curvaPotencia) {
		this.curvaPotencia = curvaPotencia;
	}

	/**
	 * @return the freqRelativa
	 */
	public double[] getFreqRelativa() {
		return freqRelativa;
	}

	/**
	 * @param freqRelativa
	 *            the freqRelativa to set
	 */
	public void setFreqRelativa(double[] freqRelativa) {
		this.freqRelativa = freqRelativa;
	}

	/**
	 * @return the sumfvpv
	 */
	public double getSumfvpv() {
		return sumfvpv;
	}

	/**
	 * @param sumfvpv
	 *            the sumfvpv to set
	 */
	public void setSumfvpv(double sumfvpv) {
		this.sumfvpv = sumfvpv;
	}
}
